using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Backend.JYD.AModel.Models.Mapping
{
    public class TaskStepInfoMap : EntityTypeConfiguration<TaskStepInfo>
    {
        public TaskStepInfoMap()
        {
            // Primary Key
            this.HasKey(t => t.TaskDetailId);

            // Properties
            this.Property(t => t.RoleIds)
                .HasMaxLength(50);

            this.Property(t => t.EmpIds)
                .HasMaxLength(50);

            this.Property(t => t.Remark)
                .HasMaxLength(500);

            // Table & Column Mappings
            this.ToTable("TaskStepInfo");
            this.Property(t => t.TaskDetailId).HasColumnName("TaskDetailId");
            this.Property(t => t.TaskId).HasColumnName("TaskId");
            this.Property(t => t.StepId).HasColumnName("StepId");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.RoleIds).HasColumnName("RoleIds");
            this.Property(t => t.EmpIds).HasColumnName("EmpIds");
            this.Property(t => t.Remark).HasColumnName("Remark");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
            this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
            this.Property(t => t.OpId).HasColumnName("OpId");

            // Relationships
            this.HasRequired(t => t.TaskBaseInfo)
                .WithMany(t => t.TaskStepInfoes)
                .HasForeignKey(d => d.TaskId);

        }
    }
}
